#!/usr/bin/env node
let jwt = require('jsonwebtoken');
const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question('想要生成多少天的token?', (answer) => {
    answer=answer||30;
    let token = jwt.sign(
        { sub: "admin",contextUserId: '0',contextName:'超级管理员',contextDeptId:'0',contextApplicationId:'0' },
        'misnice', { algorithm: 'HS256',expiresIn: answer+'d'});
    console.log(token)
    console.log(`已生成${answer}天token`);
    rl.close();
});


